Displaying data in the form of a table

Sometimes it is necessary to display a report in the form of a table with a frame. One of the examples of such report could be any price list. To build such report in FastReport, a user just needs to enable framing function for the objects located in the "Data" band. Let us demonstrate several variants of frames with the test report example.

Let us create a blank project in Delphi. Put the "TTable" component to the form, and then set its properties:

DatabaseName = 'DBDEMOS'
TableName = 'Biolife.db'

Let us add the "TfrxDBDataSet" component in order to be able to work with the table from FastReport, and then set its properties:

DataSet = Table1
UserName = 'Bio'

Let us create a report of the following ind:

Place the objects on the band line-on-line, and minimize band’s height.

The first and the simplest type of the table is a table with a full frame. To perform it, one needs to enable all frame lines in every object:

The next type of framing would display only horizontal or only vertical lines. Such framing is performed in exactly the same way. Horizontal or vertical frames can be enabled in objects.

Finally, to construct only the external framing, the report needs to be slightly modified:

As you can see, we have added two "Text" objects and enabled frame lines for the objects along the edges of the data-band. As a result, the report will look as follows:

All examples aforesaid contained bands, which possessed fixed sizes. But how is it possible to display a table, in case when the band is stretched? Let us explain that, using the example below. Add a new field (a multi-lined text from "Bio.Notes") to our report. As you already know, the "Stretch" property must be enabled both for this object and for the band, in which the object is located. In this case, the band height is selected depending on size of the text in the "Text" object. Thus, we would receive a report of the following kind:

It is a little bit different from the one we need; one would prefer the frames of the neighboring objects to be able to stretch as well. FastReport allows to solve this problem easily. For constructing such reports, it is enough to enable the "Stretch downwards" property (or StretchMode = smMaxHeight in the object inspector) for all objects, which are to be stretched. Thus, the FastReport core firstly counts the maximum band height, then it "stretches" objects with the enabled option to the bottom band edge. Due to the fact that object frames stetche together with the object, the report’s appearance changes: